package com.todo.biz.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author zhangwenxiang
 * @date 2024/3/14 19:35
 * @description
 */
@Getter
@AllArgsConstructor
public enum FeedbackStatusEnum {

    POSTED(1, "POSTED", "已提交"),
    ACCEPTED(2, "ACCEPTED", "已受理"),
    REPLIED(3, "REPLIED", "已回复"),

    ;

    private static Map<Integer, FeedbackStatusEnum> typeMap = Arrays
            .stream(FeedbackStatusEnum.values())
            .collect(Collectors.toMap(FeedbackStatusEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static FeedbackStatusEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
